﻿using Cinchoo.Core;
using Cinchoo.Core.Shell;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ChoWorkflowServer.Model
{
    [ChoCommandLineArgObject(UsageSwitch = "_")]
    public class ChoWFServerCmdLineArgsObject : ChoCommandLineArgObject
    {
        [ChoCommandLineArg("d", Description = "Debug mode")]
        public bool DebugMode;

        [ChoCommandLineArg("c", Description = "Cluster Name")]
        public string ClusterName;

        [ChoCommandLineArg("p", Description = "Private Node")]
        public bool IsPrivateNode;

        [ChoCommandLineArg("peer", Description = "Run as peer server")]
        public bool IsPeer;

        [ChoCommandLineArg("u", Description = "Turn on users and policies")]
        public bool EnableUsers;

        [ChoCommandLineArg("r", Description = "Setup / Refresh database.")]
        public bool Refresh;

        public bool RunAsPeer;

        protected override void OnAfterCommandLineArgLoaded(string memberName, object value)
        {
            if (!ClusterName.IsNullOrWhiteSpace())
            {
                if (ClusterName.StartsWith("<") && ClusterName.EndsWith(">"))
                {

                }
                else
                    ClusterName = "<{0}>".FormatString(ClusterName);
            }
            base.OnAfterCommandLineArgLoaded(memberName, value);
        }
    }
}
